//
//  JLLiuZhuanViewController.m
//  Estate
//
//  Created by heyong on 16/6/21.
//  Copyright © 2016年 ttsx. All rights reserved.
//

#import "JLLiuZhuanViewController.h"

#import "turnCell.h"
#import "ProcessRecordModel.h"


@interface JLLiuZhuanViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (strong ,nonatomic) UITableView *tableView;



@end

@implementation JLLiuZhuanViewController

- (UITableView *)tableView{
    if(_tableView==nil){
        _tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT-104)style:UITableViewStylePlain];
    }
    return _tableView;
}
// 流程记录模型
- (ProcessModel *)processModel {
    if (!_processModel) {
        _processModel = [[ProcessModel alloc] init];
    }
    return _processModel;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor colorWithRed:0.95 green:0.96 blue:0.96 alpha:1.00];
    [self.view addSubview:self.tableView];
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    self.tableView.bounces=NO;
    self.tableView.showsVerticalScrollIndicator=NO;
    self.tableView.separatorStyle = NO;
    [self.tableView registerNib:[UINib nibWithNibName:@"turnCell" bundle:nil] forCellReuseIdentifier:@"turn"];
}
#pragma  mrak--UITableViewDelegate

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    ProcessRecordModel *recordModel = self.processRecordArray[indexPath.row];;
    return  [turnCell cellContentHeight: recordModel.REVIEW_OPINION];
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.processRecordArray.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    turnCell *cell=[tableView dequeueReusableCellWithIdentifier:@"turn" forIndexPath:indexPath];
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    ProcessRecordModel *recordModel = self.processRecordArray[indexPath.row];;
    
    cell.dateLabel.text = recordModel.CREATE_DATE;
    cell.timeLabel.text = recordModel.SUBCREATE_TIME;
    cell.whoLabel.text = [LSUtility getuserIdByUserName:recordModel.CREATE_USER_NAME][@"REAL_NAME"];
    cell.ideaLabel.text = recordModel.REVIEW_OPINION;
    
    if (recordModel.PROCESS_STAGE == PROCESS_STAGE_REVIEW) {
        cell.dolabel.text = @"待审阅";
        
    } else if (recordModel.PROCESS_STAGE == PROCESS_STAGE_REVIEW_PASS_NO) {
        cell.dolabel.text = @"审阅不通过";
        
    } else if (recordModel.PROCESS_STAGE == PROCESS_STAGE_CHECK) {
        cell.dolabel.text = @"待复查";
        
    } else if (recordModel.PROCESS_STAGE == PROCESS_STAGE_CHECK_PASS_YES) {
        cell.dolabel.text = @"复查通过";
        
    } else if (recordModel.PROCESS_STAGE == PROCESS_STAGE_END) {
        cell.dolabel.text = @"结束";
    }else if (recordModel.PROCESS_STAGE == PROCESS_STAGE_DOING) {
        cell.dolabel.text = @"待执行";
    }
    return cell;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end

